﻿@model EM.OA.Portal.Models.MailBoxModels
@{
    ViewBag.Title = "WriteMail";
    Layout = "~/Views/Shared/_LayoutContent.cshtml";
}
<script type="text/javascript" src="~/Scripts/kindeditor-4.1.7/kindeditor.js"></script>

<script type="text/javascript">
    KindEditor.ready(function (K) {
        K.create('#editor4', {
            themeType: 'simple'
        });
    });

    function SendMail() {
        url = '/MailBox/SendMail';
        Send();
    }

    function Drafts() {
        url = '/MailBox/Drafts';
        Send();
    }

    function Send() {
        $('#fm').form('submit', {
            url: url,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result == 'OK') {
                    $.messager.show({
                        title: 'OK',
                        msg: '成功'
                    });
                } else {
                    $.messager.show({
                        title: 'Error',
                        msg: result
                    });
                }
            }
        });
    }

</script>

<div>
    <form id="fm" method="post">
        <table width="100%">
            <tr>
                <td>
                    <input id="btn_SendMail" type="button" value="发送" onclick="SendMail()" />&nbsp;
                <input id="btn_SendMail" type="button" value="存草稿" onclick="Drafts()" />
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(m => m.MailFrom)
                </td>
            </tr>
            <tr>
                <td>
                    <input name="MailFrom" class="easyui-validatebox" style="width: 80%" data-options="validType:'length[1,100]'">
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(m => m.MailTo)

                </td>
            </tr>
            <tr>
                <td>
                    <input name="MailTo" class="easyui-validatebox" style="width: 80%" data-options="required:true,validType:'length[1,100]'">
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(m => m.MailCC)
                </td>
            </tr>
            <tr>
                <td>
                    <input name="MailCC" class="easyui-validatebox" style="width: 80%" data-options="validType:'length[1,100]'">
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(m => m.MailSubject)
                </td>
            </tr>
            <tr>
                <td>
                    <input name="MailSubject" class="easyui-validatebox" style="width: 80%" data-options="required:true,validType:'length[1,200]'">
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(m => m.MailBody)
                </td>
            </tr>
            <tr>
                <td>
                    <input type="hidden" id="MailBody" name="MailBody" />
                    @*@Html.TextAreaFor(m => m.ApprovalRemark, new { @style = "width:100%", @cols = "40", @rows = "10", @class = "easyui-validatebox" })*@

                    <textarea id="editor4" name="editor4" style="width: 80%; height: 400px;">
			            </textarea>
                </td>
            </tr>


        </table>
    </form>

</div>

